﻿#include "card_operations.h"

int main() {
	std::cout << "===== 欢迎使用校园一卡通消费管理系统 =====" << std::endl;
	int studentNum;
	std::cout << "\n请输入学生数量（正整数）：";
	while (!(std::cin >> studentNum) || studentNum <= 0) {
		std::cin.clear();
		std::cin.ignore(1000, '\n');
		std::cout << "输入错误！请输入正整数（如3）：";
	}
	Card* students = createCards(studentNum);
	std::cout << "\n开始录入" << studentNum << "个学生的信息：" << std::endl;
	inputCards(students, studentNum);
	std::cout << "\n===== 示例操作（第一个学生） =====" << std::endl;
	deposit(students[0], 100.0);
	spend(students[0], 8.5, "食堂午餐");
	showBalance(students[0]);
	viewStudentID(&students[0]);
	std::cout << " 当前余额换算为分：" << toCent(students[0].balance) << "分" << std::endl;
	std::cout << "\n===== 所有学生账户报表 =====" << std::endl;
	printReport(students, studentNum);
	destroyCards(students);
	students = nullptr;
	std::cout << "\n按任意键退出程序...";
	system("pause");
	return 0;
}